package mips.instructions;

/**
 * <code>REGIMM</code> instruction type handler<br/>
 * @author jnmartin84@gmail.com
 */
public class REGIMM extends Instruction {

	private static final REGIMM INSTANCE = new REGIMM();
	private static final String INSTRUCTION_NAME = "REGIMM";

	private REGIMM(){}

	public static final REGIMM getInstance() {
		return INSTANCE;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final void execute(int instruction) throws Exception {
		Instruction.getRegimm(Instruction.RT_FT(instruction)).execute(instruction);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String emit(final int instruction) {
		return Instruction.getRegimm(Instruction.RT_FT(instruction)).emit(instruction);
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String getName(final int instruction) {
		return Instruction.getRegimm(Instruction.RT_FT(instruction)).getName(instruction);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String getName() {
		return INSTRUCTION_NAME;
	}
}